// src/utils/validators.ts
export const ipPattern =
  /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/

export const portPattern =
  /^([0-9]|[1-9]\d{1,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$/

// 可以封装成函数以便更灵活地使用
export const validateIP = (value: string) => ipPattern.test(value)
export const validatePort = (value: string) => portPattern.test(value)
